import type { DeptInfo, DeptQuery, DeptTreeNode } from '@/types/dept.type'
import type { ApiResponse } from '@/types/common.type'
import {
  mockGetDeptList,
  mockGetDeptTree,
  mockCreateDept,
  mockUpdateDept,
  mockDeleteDept
} from '@/mock/dept'

// 获取部门列表
export function getDeptList(params: DeptQuery): Promise<ApiResponse<DeptInfo[]>> {
  return mockGetDeptList(params)
}

// 获取部门树
export function getDeptTree(): Promise<ApiResponse<DeptTreeNode[]>> {
  return mockGetDeptTree()
}

// 创建部门
export function createDept(data: Omit<DeptInfo, 'id'>): Promise<ApiResponse<number>> {
  return mockCreateDept(data)
}

// 更新部门
export function updateDept(data: DeptInfo): Promise<ApiResponse<void>> {
  return mockUpdateDept(data)
}

// 删除部门
export function deleteDept(id: number): Promise<ApiResponse<void>> {
  return mockDeleteDept(id)
} 